#pragma once

#include "Node.h"
#include "Algorithm.h"
#include "Factory.h"			/* factory is refered on this file
								 * only */
#include "InputBuffer.h"

class NodeManager{
private:
	Algorithm algo;
	Factory factory;
	Node* root;
	Node* cursor; 
	InputBuffer *buffer;
	int mode;
	CRect viewRt;

public:
	NodeManager();
	~NodeManager();
	void inputCheck();
	void drawAll(IDrawTool*);
	void appendNode();
	void setInputBuffer(InputBuffer*);
	void setRootPoint(CPoint*);
	void processFuncKey();
	int localInput(UINT nChar);
	int normalModeInput(UINT);
	int getMode();
	void endEditMode();
	CRect getCursorRect();
	Node* getCursor();

	void ChangeCursorFocus( Node* now, int direction );
	void SetCursor(Node* node);
//	void moveCusor(CPoint);
	Node* GetRoot();
	void findHitedNode(CPoint);
	void setViewRt(const CRect*);
};
